﻿<UserControl x:Class="ResourceBlender_Express.DatabaseTranslationInput"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:ResourceBlender_Express"
    xmlns:converters="clr-namespace:ResourceBlender_Express.Converters"
    xmlns:validators="clr-namespace:ResourceBlender_Express.Validators"
    DataContext="{Binding RelativeSource={RelativeSource Self}}"
    Height="Auto" Width="Auto">
    <UserControl.Resources>
        <ResourceDictionary>
            <converters:LanguageCodeConverter x:Key="LanguageCodeConverter" />
            <BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter" />
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="Margin" Value="0,2,8,1" />
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Border BorderBrush="{StaticResource GroupBoxBorderBrush}" BorderThickness="1" CornerRadius="2">
        <Grid Margin="5,2,5,2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" MinWidth="140" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition  MinWidth="20" Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" MinHeight="20" />
                <RowDefinition Height="Auto" MinHeight="20" />
                <RowDefinition Height="*" MinHeight="20" />
            </Grid.RowDefinitions>
            
            <TextBlock x:Name="lblEnglishName" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2"  /><!-- text set from code-behind -->
            <TextBox x:Name="txtTranslation" Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Text="{Binding Path=Translation.Translation,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" MaxHeight="80" VerticalScrollBarVisibility="Auto" />
            <loc:ImageButton x:Name="btnFullEditorTranslation" Grid.Row="0" Grid.Column="2" Image="Resources/images/resource_expand_16.png" ShowText="False" ToolTip="Open the full editor for this translation" Margin="1" MaxHeight="24" 
                             Command="loc:ResourceBlenderCommands.OpenFullEditor" CommandTarget="{Binding ElementName=txtTranslation}" />
            <loc:MenuButton x:Name="btnAutoTranslate" Grid.Row="1" Grid.Column="2" Margin="1" MaxHeight="24" MenuLocation="Bottom" ShowArrow="False" AlwaysShowBorder="True" >
                <loc:MenuButton.Content>
                    <Image Source="pack://application:,,,/Resources/images/autotranslate_16.png" Stretch="None"/>
                </loc:MenuButton.Content>
                <loc:MenuButton.Menu>
                    <ContextMenu x:Name="ctxAutoTranslate" />
                </loc:MenuButton.Menu>
            </loc:MenuButton>

            <TextBlock Grid.Row="2" Grid.Column="0">Translator Comment</TextBlock>
            <TextBox x:Name="txtComment" Grid.Row="2" Grid.Column="1" Text="{Binding Path=Translation.Comment,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" MaxHeight="80" VerticalScrollBarVisibility="Auto" />
            <loc:ImageButton x:Name="btnFullEditorComment" Grid.Row="2" Grid.Column="2" Image="Resources/images/expand_16.png" ShowText="False" ToolTip="Open the full editor for the translator's comment" Margin="1,1,0,1" MaxHeight="24" MinWidth="20" VerticalAlignment="Top"
                           Command="loc:ResourceBlenderCommands.OpenFullEditor" CommandTarget="{Binding ElementName=txtComment}" />
        </Grid>
    </Border>
</UserControl>
